package com.disv.service.strategy.impl;

import com.alibaba.fastjson2.JSON;
import com.disv.service.strategy.DingCallBackService;
import com.disv.support.config.CacheManagerUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * 当biz_type=2时
 * 数据为第三方企业应用票据suiteTicket最新状态
 *
 * @author hyt
 * @date 2023/06/02
 */
@Service
public class DingSuiteTicketCallBackServiceImpl implements DingCallBackService {
    @Value("${dd.app.suiteKey}")
    private String dingAppSuiteKey;

    @Override
    public int getBizType() {
        return 2;
    }

    @Override
    public void action(String bizData) {
        String suiteTicket = JSON.parseObject(bizData).getJSONObject("biz_data").getString("suiteTicket");
        CacheManagerUtil.setCacheValue(dingAppSuiteKey, suiteTicket);
    }
}
